<!-- 列表统计 -->
<template>
  <div>
    <slot></slot>

    <main>
      <div class="main_header">
        <div class="user_info" style="">
          <el-avatar :size="70" style="flex-shrink: 0;border-radius: 50%;">
            <span>主</span>
          </el-avatar>
          <div class="user_info_int">
            <p class="fw">
              平均时效：
              <el-popover placement="bottom" trigger="hover">
                <ul class="employee-list">
                  <li>
                    <span class="name">吴伟立</span>
                    平均时效：<span class="day">4.5天</span>
                  </li>
                  <li>
                    <span class="name">杨秀欢</span>
                    平均时效：<span class="day">4.5天</span>
                  </li>
                </ul>
                <span class="drop" slot="reference">
                  4.5天 <i class="el-icon-caret-bottom ico"></i>
                </span>
              </el-popover>
            </p>
            <p class="info_role">
              <span class="role_1">部门：客服部1</span>
              <el-divider direction="vertical"></el-divider>
              <span class="role_2">角色：派单</span>
            </p>
          </div>
        </div>
        <div class="info_right">
          <el-row :gutter="15" style="">
            <el-col
              class="info_item"
              :lg="3"
              :sm="4"
              :xs="8"
              v-for="item in infoData"
              :key="item.name"
            >
              <p>{{ item.name }}</p>
              <p class="num">{{ item.value || "--" }}</p>
            </el-col>
          </el-row>
        </div>
      </div>
      <el-divider></el-divider>
      <el-row :gutter="15">
        <el-col
          :span="6"
          :lg="3"
          :xs="12"
          v-for="(item, index) in listData"
          :key="index"
          style="margin-top: 7.5px ;margin-bottom: 7.5px;"
        >
          <el-card shadow="never">
            <div class="box-card">
              <div style="grid-area: a;">
                {{ item.name }}
              </div>
              <div style="grid-area: b;" class="grid_b">
                <span>
                  <svg-icon
                    :icon-class="item.icon"
                    class-name="icon"
                  ></svg-icon>
                </span>
              </div>
              <div style="grid-area: c;font-weight: bold;font-size: 22px;">
                {{ item.value }}
              </div>
            </div>
          </el-card>
        </el-col>
      </el-row>
    </main>
  </div>
</template>

<script>
export default {
  data() {
    return {
      listData: [
        { name: "已接单", value: "935", icon: "received" },
        { name: "已回单", value: "35", icon: "receipt" },
        { name: "已亏损", value: "0", icon: "lost" },
        { name: "已废除", value: "50", icon: "abolished" },
        { name: "留存量", value: "850", icon: "stock" },
        { name: "完结率", value: "10%", icon: "completionrate" },
        { name: "留存率", value: "90%", icon: "stockrate" },
        { name: "废除率", value: "10%", icon: "repealrate" }
      ],
      infoData: [
        { name: "资金流水", value: "" },
        { name: "利润", value: "" },
        { name: "亏损金额", value: "" },
        { name: "入驻师傅", value: 1 },
        { name: "入驻厂商", value: 0 }
      ]
    };
  }
};
</script>

<style lang="scss" scoped>
// @import "@/assets/styles/element-variables.scss";
$mt: 24px;
$themeColor: var(--color-primary);
main {
  margin-top: $mt;

  .main_header {
    display: inline-flex;
    align-items: center;
    width: 100%;
    flex-wrap: wrap;

    .info_right {
      padding: 0 15px;
      flex: 1;
      .info_item {
        p {
          text-align: center;
          line-height: 2;

          &.num {
            font-weight: bold;
            font-size: 18px;
          }
        }
      }
      @media (max-width: 768px) {
        flex: 0 0 100%;
      }
    }
    .user_info {
      position: relative;
      display: inline-flex;
      align-items: center;

      .user_info_int {
        margin-left: 15px;
        padding-right: 40px;
        p {
          line-height: 1.8;
          color: black;

          &.fw {
            font-weight: bolder;
            font-size: 18px;
            .drop {
              color: $themeColor;
              font-size: 18px;
              .ico {
                color: black;
              }
            }
          }
        }
      }

      &::after {
        content: "";
        display: inline-block;
        width: 1px;
        height: 80%;
        position: absolute;
        right: 0;
        top: 10%;
        background-color: #e2e2e2;
      }

      @media (max-width: 768px) {
        padding-bottom: 15px;
        margin-bottom: 15px;
        width: 100%;

        .info_role {
          .role_2 {
            display: block;
          }
        }
        &::after {
          // height: 50%; /* 在小屏幕下改变高度 */
          // top: 25%; /* 在小屏幕下改变位置 */

          height: 1px;
          width: 100%;
          top: auto;
          bottom: 0;
          left: 0;
          right: 0;
        }
      }

      .el-avatar {
        background-color: var(--color-primary-bg);
        span {
          font-size: 24px;
          color: $themeColor;
        }
      }
    }
  }
}

.box-card {
  width: 100%;
  height: 100%;
  // min-height: 75px;
  display: inline-grid;
  grid-gap: 5px;
  grid-template-areas:
    "a a b"
    "c c c";

  & > div {
    display: flex;
    align-items: center;
  }

  .grid_b {
    span {
      height: 100%;
      background-color: var(--color-primary-bg);
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 8px;
      border-radius: 5px;

      .icon {
        font-size: 14px;
        color: $themeColor;
      }
    }
  }
}

.el-card {
  :deep(.el-card__body) {
    padding: 15px;
  }
}

.employee-list {
  list-style: none; /* 移除默认的列表样式 */
  padding: 0; /* 移除内边距 */
}

.employee-list li {
  padding: 7px 0; /* 添加上下内边距，使分割线更清晰 */
  color: black;
  font-size: 16px;

  .name {
    display: inline-block;
    width: 60px;
  }

  .day {
    color: $themeColor;
  }
}

.employee-list li:not(:last-child) {
  border-bottom: 1px solid #ccc; /* 添加底部分割线，但不包括最后一个 li 元素 */
}
</style>
